import { UUID3 } from "../../utils/utils";

export default class Component {
  id = null;
  animations = [];
  name = null;
  type = null;
  parentId = null;

  alias = null;
  icon = null;
  img = null;

  locked = false;
  hidden = false;

  selected = false;
  hovered = false;
  // 元件属性
  attr = {
    top: 0,
    left: 0,
    width: 100,
    height: 100,
    rotate: 0,
    opacity: 1,
    filpV: false,
    filpH: false
  };
  // 项目id
  projectId = 0;
  // 配置项
  config = null;

  // dataSource
  dataSource = null;

  // 事件
  events = null;

  // 动作
  actions = null;

  // 绑定值
  propValue = null;
  children = [];

  constructor(comp, attr) {
    this.id = UUID3(10);
    this.name = `${comp.name}`;
    this.icon = `${comp.icon}`;
    this.img = `${comp.img}`;
    this.alias = `${comp.name}`;
    this.type = `${comp.type}`;
    this.attr = { ...this.attr, ...attr };
  }

  initData () {

  };

  loadData () {

  };
}
